<template>
  <div class="chart" ref="chart" style="width:100%;height:100%"></div>
</template>

<script>
// 需要用这种形式
import * as echarts from 'echarts'
export default {
  name: 'BarChart',
  mounted() {
    let barChart = echarts.init(this.$refs.chart)

    barChart.setOption({
      // x轴的配置项
      xAxis: {
        type: 'category',
        show: false
      },
      // y轴的配置项
      yAxis: {
        show: false
      },
      // 系列
      series: [
        {
          type: 'bar',
          data: [10, 7, 33, 12, 20, 9, 29, 10, 44],
        }
      ],
      // 布局调试
      grid: {
        left: 0,
        top: 0,
        bottom: 0,
        right: 0
      }
    })
  }
}
</script>

<style scoped></style>